/*----------验证控件合法性，并返回bool值----------------
--------------------------------------------------------*/
if (!GGServer.Class.Dom) GGServer.Class.Dom = {};

GGServer.Class.Dom.CheckForms = function() {
    var o = this;
    o.form = null;
    o.clientID = null;
    var errObj = null;
    var subTimerID;
    var ti = 10;
    var allelements = {};
    o.IsCheckForms = {
        //单一验证控件。
        check: function() {
            var CFS = {
                checkobj: arguments[0],
                message: arguments[1]
            }
            //this.IsEvent(CFS.checkobj);
        },
        //验证一组控件(使用递归方式)
        checkGroup: function() {

            var args = {
                obj: arguments[0]
            }
            var elements = document.getElementById(args.obj).getElementsByTagName("input");
            //this.initAll(elements);
            this.SearchNode(elements, args.obj);
            //查询出所有textarea
            elements = document.getElementById(args.obj).getElementsByTagName("textarea");
            //this.initAll(elements);
            this.SearchNode(elements, args.obj);
            //查询出所有select
            elements = document.getElementById(args.obj).getElementsByTagName("select");
            //this.initAll(elements);
            this.SearchNode(elements, args.obj);
        },
        initAll: function(es) {
            for (var i = 0; i < es.length; i++) {
                if ($(es[i]).attr("group")) {
                    var group = $(es[i]).attr("group");
                    var arry;
                    if (allelements[group]) { arry = allelements[group]; }
                    else { arry = []; }
                    arry[arry.length] = es[i];
                    allelements[group] = arry;
                }
            }
        }
        ,
        SearchNode: function(sobj, obj, r, um) {
            var elements = sobj;
            var subResult = true;
            var j = 0;
            for (var i = 0; i < elements.length; i++) {
                //msg:错误提示 pattern:自定义正则 ct:验证类型,第几种形式 min:最小字符限制 max:最大字符限制
		if (elements[i].tagName.toLowerCase() != "select") {
                try { $(elements[i]).val($.trim($(elements[i]).val())) } catch (e) { }
		}
                if ($(elements[i]).attr("ct")) {
                    if ($(elements[i]).css("display") == "none") {
                        continue;
                    }
                    var ct = $(elements[i]).attr("ct");
                    var dat = {
                        Allobj: obj,
                        obj: elements[i],
                        ID: $(elements[i]).attr("id"),
                        CT: ct,
                        Relation: $(elements[i]).attr("Relation"),
                        UserMsg: $(elements[i]).attr("UserMsg"),
                        t: r
                    };
                    if (r == null) {
                        try {
                            this.IsEvent(dat);
                        }
                        catch (ex) {

                        }

                    }
                    else if (r == 2) {
                        if (!dat.UserMsg) { continue; }
                        var ar;
                        if (!um[dat.UserMsg]) {
                            ar = [];
                        }
                        else {
                            ar = um[dat.UserMsg];
                        }
                        ar[ar.length] = dat;
                        um[dat.UserMsg] = ar;
                    }
                    else {
                        if (ct && !$(elements[i]).attr("isCheck")) {
                            if (!this.CheckMessage(dat)) {
                                if (j == 0) {
                                    //alert(elements[i].id);
                                    try {
                                        errObj = elements[i];
                                        var t = errObj.offsetTop; var l = errObj.offsetLeft;
                                        while (errObj = errObj.offsetParent) {
                                            t += errObj.offsetTop;
                                            l += errObj.offsetLeft;
                                        }
                                        window.scrollTo(l, t);
                                        //window.scrollTo(0, 0);
                                    }
                                    catch (E) {
                                        window.scrollTo(0, 0);
                                    }
                                }
                                subResult = false;
                                j++;
                            }
                        }
                    }
                }
            }
            if (r == 2) {
                return um;
            }
            return subResult;
        },
        IsEvent: function(obj) {
            var e = this;
            var regBool;
            if ($(obj.obj).attr("ct")) {
                if ($(obj.obj).attr("ct").toLowerCase() == "submit") {
                    if (o.form == null) {

                        document.getElementById(obj.ID).onclick = function() {
                            try {

                                var regBool = true; if (!e.CheckByUM(obj, e)) { regBool = false; }
                                var IsBiz = document.getElementsByName("IsBiz")[0];
                                if (IsBiz && IsBiz.disabled) {
                                    //IsBiz.disabled = false;
                                    if (IsBiz.checked) {
                                        IsBiz.value = 1;
                                    }
                                    else {
                                        IsBiz.value = 0;
                                    }
                                }
                                if (!regvalue()) {
                                    regBool = false;
                                }
                                if (!regBool) { return false; }
                                var codel = document.getElementsByName("codeText");
                                if (codel && codel.length > 0) {
                                    e.QtoB1(codel[0]);
                                }
                                if (changeValue == 1) {
                                    if (sub() == false) {
                                        return false;
                                    }
                                }
                                setcontentvalue();
                                document.getElementById('aspnetForm').action = window.location.href + "/submit";
                                //document.getElementById('aspnetForm').action = window.location.href;
                                document.getElementById('aspnetForm').submit();
                                document.getElementById(obj.ID).disabled = true;
                                document.getElementById(obj.ID).value = '正在发布...';
                                //subTimerID = window.setInterval(function() { document.getElementById('fabu').value = "(" + ti + ")信息正在提交中"; document.getElementById('fabu').disabled = true; ti--; if (ti == 0) { clearInterval(subTimerID); ti = 10; } else if (!flagSubmit) { clearInterval(subTimerID); ti = 10; $('fabu').value = "发布"; $('fabu').disabled = false; } }, 1000);
                                return regBool;
                            }
                            catch (ex) {
                                //alert(ex.message);
                                //document.getElementById('aspnetForm').action = window.location.href;
                                document.getElementById('aspnetForm').action = window.location.href + "/submit";
                                document.getElementById('aspnetForm').submit();
                                document.getElementById(obj.ID).disabled = true;
                                document.getElementById(obj.ID).value = '正在发布...';
                                //subTimerID = window.setInterval(function() { document.getElementById('fabu').value = "(" + ti + ")信息正在提交中"; document.getElementById('fabu').disabled = true; ti--; if (ti == 0) { clearInterval(subTimerID); ti = 10; } else if (!flagSubmit) { clearInterval(subTimerID); ti = 10; $('fabu').value = "发布"; $('fabu').disabled = false; } }, 1000);
                                //alert(ex.message);
                                return regBool;
                            }
                        }
                    } else {
                        document.getElementById(o.form).onsubmit = function() {
                            var elements = document.getElementById(obj.Allobj).getElementsByTagName("input");
                            regBool = e.SearchNode(elements, obj.Allobj, "1");

                            elements = document.getElementById(obj.Allobj).getElementsByTagName("textarea");
                            regBool = e.SearchNode(elements, obj.Allobj, "1");

                            elements = document.getElementById(obj.Allobj).getElementsByTagName("select");
                            regBool = e.SearchNode(elements, obj.Allobj, "1");
                            if (regBool != null) { alert("未能提交! 请先完善红色提示部分内容，再发布。"); }
                            return regBool;
                        }
                    }
                }
                else {
                    if (obj.CT.split(",")[0].toLowerCase() != "selecttime" && !$(obj.obj).attr("isCheck")) {
                        var methond = $(obj.obj).attr("methond");
                        if (methond) {
                            if (methond.split(',')[0] == "2") { return; }
                        }
                        document.getElementById(obj.ID).onblur = function() {//失去焦点
                            e.CheckMessage(obj, 0);
                        }
                        document.getElementById(obj.ID).onfocus = function() {//得到焦点
                            //e.ClearMessage();
                            e.ShowTip(obj);
                        }
                    }
                    if (obj.obj.tagName.toLowerCase() == "select" && $(obj.obj).attr("relationID")) {
                        obj.obj.onchange = function() {
                            e.GetRelations(obj.obj);
                            if ($(obj.obj).attr("changemethond")) {
                                setTimeout($(obj.obj).attr("changemethond") + '()', 500);
                            }
                        }
                    }
                }
            }
            else {
                if (obj.CT.split(",")[0].toLowerCase() != "selecttime") {
                    document.getElementById(obj.ID).onblur = function() {
                        e.CheckMessage(obj);
                    }
                }

            }
        },
        ClearCheckMessage: function(obj) {
            var relationID = $(obj.obj).attr("Relation");
            var UserMsg = $(obj.obj).attr("UserMsg");
            if (document.getElementById(obj.ID + "_message") != null) { document.getElementById(obj.ID + "_message").className = ""; document.getElementById(obj.ID + "_message").innerHTML = ""; }
            if (document.getElementById(relationID + "_message") != null) { document.getElementById(relationID + "_message").className = ""; document.getElementById(relationID + "_message").innerHTML = ""; }
            if (document.getElementById(UserMsg + "_message") != null) { document.getElementById(UserMsg + "_message").className = ""; document.getElementById(UserMsg + "_message").innerHTML = ""; }
        },
        ClearMessage: function() {
            var spanList = document.getElementsByTagName("span");
            for (var i = 0; i < spanList.length; i++) {
                var o = spanList[i];
                if ($(o).attr("id") && $(o).attr("id").indexOf("_message") != -1) {
                    o.className = "";
                    o.innerHTML = "";
                    o.style.display = '';
                }
            }
        }
		,
        CheckMessage: function(obj, t) {
            //alert(obj.UserMsg);
            var result = this.StartCheck({ obj: obj.obj,
                ID: obj.ID,
                content: document.getElementById(obj.ID).value,
                checktype: obj.CT,
                UserMsg: obj.UserMsg,
                t: t,
                t1: obj.t
            });
            if (result) {
                result = this.CheckWithIQASRegex(obj);
                if (result) {
                    var msgObj = document.getElementById(obj.UserMsg + "_message");
                    if (msgObj != null) {
                        var s = true;
                        if ($(obj.obj).attr("Except") && $(obj.obj).attr("Except") == "null") {
                            msgObj.className = "";
                            msgObj.innerHTML = "";
                            s = false;
                        }
                        if (s) {
                            msgObj.className = "chenggong";
                            msgObj.innerHTML = "";
                        }
                    }
                    if ($(obj.obj).attr("fun")) {
                        setTimeout($(obj.obj).attr("fun") + "()", 50);
                    }
                    if ($(obj.obj).attr("setvalue") && !obj.t1) {
                        appendvalue();
                    }
                    if (obj.t1 && obj.id == "Title") {
                        obj.disabled = "";
                    }
                }
                return result;
            }
            else {
                return result;
            }
        },
        CheckWithIQASRegex: function(obj) {
            if (obj.obj.style.display == "none")
                return true;
            if (obj.obj.value != "") {
                obj.obj.value = obj.obj.value.replace(/(^\s*)|(\s*$)/g, "");
            }
            var reg;
            var regStr;
            var regTestResult = true;
            var url = document.URL;
            var exceptnull = $(obj.obj).attr("Except") == "null";

            switch (obj.ID.toUpperCase()) {
                case "TITLE":
                    if (obj.obj.value.length == 0) {
                        this.ShowIQASTip(obj, "请填写标题");
                        return false;
                    }
                    regStr = /[\u4e00-\u9fa5]/;
                    reg = new RegExp(regStr);
                    regTestResult = reg.test(obj.obj.value);
                    if (!regTestResult) {
                        this.ShowIQASTip(obj, "标题太过简单");
                        return false;
                    }
                    else {
                        if (url.indexOf('/48/') == -1) { //网游/虚拟物品除外
                            regStr = /\w+@[a-zA-Z0-9\-\.]+\.(com|cn|tel|mobi|net|org|asia|me|hk|tv|biz|cc|name|info|公司|网络|中国)/;
                            reg = new RegExp(regStr);

                            regTestResult = reg.test(obj.obj.value);
                            if (!regTestResult) {
                                regStr = /[a-zA-Z0-9\-\.]+\.(com|cn|tel|mobi|net|asia|me|hk|tv|biz|cc|name|info|org|公司|网络|中国)/;
                                reg = new RegExp(regStr);
                                regTestResult = reg.test(obj.obj.value);
                            }
                            if (regTestResult) {
                                this.ShowIQASTip(obj, "请不要在标题里留下email或网址。");
                                return false;
                            }
                            else {
                                if (url.indexOf('/48/') == -1 && url.indexOf('/241/') == -1) {
                                    regStr = /([0-9０１２３４５６７８９零一二三四五六七八九壹贰叁肆伍陆柒捌玖]{7})/;
                                    reg = new RegExp(regStr);
                                    regTestResult = reg.test(obj.obj.value);
                                    if (!regTestResult) {
                                        regStr = /(([qｑQＱ]+)(.?|.{1,5})(([0-9]|[０-９]|[零一二三四五六七八九]|[①-⑨]|[㈠-㈨])[-_@\~\#\$\%\^\&\*]*){5,13})|((([0-9]|[０-９]|[零一二三四五六七八九]|[①-⑨]|[㈠-㈨])[-_@\~\#\$\%\^\&\*]*){5,13}(.?|.{1,5})([qｑQＱ]+))/;
                                        reg = new RegExp(regStr);
                                        regTestResult = reg.test(obj.obj.value);
                                    }
                                    if (regTestResult) {
                                        this.ShowIQASTip(obj, "标题中不允许填写联系方式。");
                                        return false;
                                    }
                                    else {
                                        return true;
                                    }
                                }
                                else {
                                    return true;
                                }
                            }
                        }
                        else {
                            return true;
                        }
                    }
                    break;
                case "CONTENT":
                    if (!exceptnull) {
                        if (obj.obj.value.length == 0) {
                            this.ShowIQASTip(obj, "请填写内容");
                            return false;
                        }
                        regStr = /[\u4e00-\u9fa5]/;
                        reg = new RegExp(regStr);
                        regTestResult = reg.test(obj.obj.value);
                        if (!regTestResult) {
                            this.ShowIQASTip(obj, "内容太过简单");
                            return false;
                        }
                        else {
                            return true;
                        }
                    }
                    else return true;
                    break;
                case "XIAOQU":
                    try {
                        win.closeToolTipWindow();
                    } catch (E) { }
                    if (obj.obj.style.display == "") {
                        if (obj.obj.value.length < 2) {
                            this.ShowIQASTip(obj, "2-30个字，不能填写电话和特殊符号");
                            return false;
                        }
                        else if (new RegExp(/^\d+$/).test(obj.obj.value)) {
                            this.ShowIQASTip(obj, "小区不能为纯数字");
                            return false;
                        }
                        else {
                            return true;
                        }
                    }
                    return true;
                    break;
                case "DIZHI":
                    obj.obj.value = obj.obj.value.replace(/[,\.\(\)\{\}\s\-\*，。（）【】“”—‘’"']/g, "");
                    return true;
                    break;
                case "FLOOR":
                case "ZONGLOUCENG":
                case "HUXINGSHI":
                case "HUXINGSHI1":
                case "HUXINGTING":
                case "HUXINGWEI":
                    var canReturn = false;
                    if (!document.getElementById("Floor") || document.getElementById("Floor").style.display == "none") {
                        canReturn = true;
                    }
                    else {
                        var zonglouceng = document.getElementById("zonglouceng").value;
                        var floor = document.getElementById("Floor").value;
                        var msgObj = document.getElementById("Floor_message");
                        if (zonglouceng != "" && floor != "" && Number(floor) > Number(zonglouceng)) {
                            if (document.getElementById("Floor").value != "") {
                                this.ShowIQASTip(obj, "总楼层不能小于所在楼层");
                            }
                            return false;
                        }
                        else {

                            if (document.activeElement.id == "Floor") { this.ShowTip(obj, "填写整数，不能是“0”。地下室用负数填写，如-3"); return true; }
                            else if (document.activeElement.id == "zonglouceng") { this.ShowTip(obj, "填写整数，不能是“0”和负数"); return true }
                            else if (zonglouceng == "" || floor == "") {
                                this.ShowIQASTip(obj, "请填写楼层");
                                return false;
                            }
                            else if ((floor != "" && zonglouceng != "") && isNaN(floor) || isNaN(zonglouceng) || Number(zonglouceng) <= 0 || Number(floor) == 0) {
                                this.ShowIQASTip(obj, "楼层必须为数字，不能是“0”。总楼层不能是“负数”。");
                                return false;
                            }
                            else if (zonglouceng != "" && floor != "" && Number(zonglouceng) > 0) {
                                this.ShowChenggongTip(obj);
                                canReturn = true;
                            }
                            canReturn = true;
                        }
                    }
                    var objHxs = document.getElementById("huxingshi1");
                    var checktingwei = true;
                    regStr = /\/12\/s/;
                    reg = new RegExp(regStr);
                    if (objHxs == null && reg.test(document.body.innerHTML) && objHxs.style.display == "none") {
                        checktingwei = false;
                    }
                    if (objHxs == null || objHxs.style.display == "none") { objHxs = document.getElementById("huxingshi"); if ($(objHxs).attr("type") != "text" || objHxs.style.display == "none") { checktingwei = false; } };
                    var huxingshi = objHxs.value;

                    var huxingting = document.getElementById("huxingting").value;
                    var huxingwei = document.getElementById("huxingwei").value;
                    var msgObj = document.getElementById("huxingshi_message");
                    if (checktingwei && (huxingshi == "" || huxingting == "" || huxingwei == "")) {
                        this.ShowIQASTip(obj, "请填写户型");
                        return false;
                    }
                    else {
                        regStr = /^[1-9]$/;
                        reg = new RegExp(regStr);
                        var regStr2 = /^[0-9]$/;
                        var reg2 = new RegExp(regStr2);
                        if (!checktingwei || (reg.test(huxingshi) && reg2.test(huxingting) && reg2.test(huxingwei))) {
                            this.ShowChenggongTip(obj);
                            if (canReturn) return true;
                        }
                        else {
                            this.ShowIQASTip(obj, "户型必须为整数，居室不能填写0");
                            return false;
                        }
                    }
                    break;

                case "STARTSTATION":
                    if (obj.obj.value == "起点站") {
                        this.ShowIQASTip(obj, "请输入起点站");
                        return false;
                    }
                    else {
                        return true;
                    }
                    break;
                case "ENDSTATION":
                    if (obj.obj.value == "终点站") {
                        this.ShowIQASTip(obj, "请输入终点站");
                        return false;
                    }
                    else {
                        return true;
                    }
                    break;
                case "AREA":
                    if (!exceptnull) {
                        if (new RegExp(/^\d+$/).test(obj.obj.value)) {
                            clearErrTip(document.getElementById("area_message"));
                            return true;
                        }
                        else {
                            this.ShowIQASTip(obj, "请输入面积");
                            return false;
                        }
                    }
                    else {
                        clearErrTip(document.getElementById("area_message"));
                        return true;
                    }
                    break;
                default:
                    return true;
                    break;
            }
        },
        ShowIQASTip: function(obj, msg) {
            var msgObj;
            if (document.getElementById(obj.UserMsg + "_message") != null) {
                msgObj = document.getElementById(obj.UserMsg + "_message");
                msgObj.className = '';
            }
            try {
                setTimeout(function() {
                    SetTipInfo(msgObj, msg, true);
                }, 1);
            }
            catch (ex) {

            }
        },
        ShowIQASTip2: function(msgObj, msg) {
            SetTipInfo(msgObj, msg, true);
        },
        ShowChenggongTip: function(obj) {
            var msgObj;
            if (document.getElementById(obj.UserMsg + "_message") != null) {
                msgObj = document.getElementById(obj.UserMsg + "_message");
            }
            msgObj.innerHTML = "";
            msgObj.className = "chenggong";
        },
        ShowTip: function(obj) {
            var msgObj;
            var ShowText = "";
            if (document.getElementById(obj.UserMsg + "_message") != null) {
                msgObj = document.getElementById(obj.UserMsg + "_message");
            }
            if ($(obj.obj).attr("Tip")) {
                SetTipInfo(msgObj, $(obj.obj).attr("Tip"), false);
            }

            if ($(obj.obj).attr("focusHeight")) {
                obj.obj.style.height = $(obj.obj).attr("focusHeight") + "px";
            }
            if ($(obj.obj).attr("Except") && $(obj.obj).attr("Except") != "null" && obj.obj.value == $(obj.obj).attr("Except")) {
                obj.obj.value = "";
                obj.obj.style.color = '#000';
            }
            msgObj.style.zIndex = 999;
        },
        ShowTip2: function(msgObj, msg) {
            SetTipInfo(msgObj, msg, false);
        },
        ShowTip1: function(obj) {
            var ct = $(obj).attr("ct");

            var dat = {
                Allobj: obj,
                obj: obj,
                ID: $(obj).attr("id"),
                CT: ct,
                Relation: $(obj).attr("Relation"),
                UserMsg: $(obj).attr("UserMsg"),
                t: 0
            };

            this.ShowTip(dat);
        },
        //
        ChangeBgColor: function(formName) {
            var elements = document.getElementById(formName).getElementsByTagName("input");
            for (var i = 0; i < elements.length; i++) {
                document.getElementById($(elements[i]).attr("id")).style.backgroundColor = "#fff";
            }
        },
        CheckDefault: function(obj, msgObj) {
            var ShowText = "";
            var RegStr = "";
            if (obj.obj.style.display == "none") {
                return true;
            }
            if ($(obj.obj).attr("Message")) {
                ShowText = $(obj.obj).attr("Message");
            }
            if ($(obj.obj).attr("RegStr")) {
                RegStr = $(obj.obj).attr("RegStr");
            }
            if ($(obj.obj).attr("Except"))//如果有默认值在正则规则之外的话先判断默认值
            {
                if ($(obj.obj).attr("Except") == "null") {
                    cookie.set($(obj.obj).attr("Name"), "null");
                    if (obj.obj.value == '') {
                        return true;
                    }
                }
                if (obj.t == 0 && obj.obj.value == '') {
                    obj.obj.value = $(obj.obj).attr("Except");
                    obj.obj.style.color = '#666';
                }
                if (obj.obj.value == $(obj.obj).attr("Except")) {
                    return true;
                }
            }
            if ($(obj.obj).attr("methond"))//如果正则表达式无法判断要用特殊方法判断
            {
                var argObj = new Object();
                argObj.num = $(obj.obj).attr("methond").split(',')[0];
                argObj.obj = obj.obj;
                if ($(obj.obj).attr("methond").split(',')[1]) {
                    argObj.cobj = $(obj.obj).attr("methond").split(',')[1];
                }
                if ($(obj.obj).attr("min")) {
                    argObj.min = $(obj.obj).attr("min");
                }
                if ($(obj.obj).attr("max")) {
                    argObj.max = $(obj.obj).attr("max");
                }
                argObj.msgObj = msgObj;
                argObj.ShowText = ShowText;
                if (!this.CheckSpecial(argObj)) {

                    return false;
                }
                return true;
            }
            var rex;
            var regstrArray = RegStr.split('#');
            var messageArray = ShowText.split('#');
            var checkValue = this.QtoB1(obj.obj);
            if (checkValue) {
                if (obj.obj.id == "Title" || obj.obj.id == "Content") {
                    checkValue = checkValue.replace(/\s/ig, "");
                }
            }
            if (checkValue.length == 0 && regstrArray[0] == "^[\\s\\S]*$") {

                if ($(obj.obj).attr("type") && $(obj.obj).attr("type") != "radio") {
                    SetTipInfo(msgObj, messageArray[0], true);
                    return false;
                }
            }
            for (var i = 0; i < regstrArray.length; i++) {
                if (regstrArray[i] == "" && regstrArray[i] == null) { continue; }
                try {
                    rex = new RegExp(regstrArray[i], "ig");
                }
                catch (ex) { return true; }
                if (!rex.test(checkValue)) {
                    setTimeout(function() {
                        SetTipInfo(msgObj, messageArray[i], true);
                    }, 10);
                    return false;
                }
            }
            return true;
        },
        CheckSelect: function(obj, msgObj) {
            if (obj.obj.value == "-1" || obj.obj.value == "") {
                if (!msgObj) { return true; }
                if ($(obj.obj).attr("Message")) {
                    SetTipInfo(msgObj, $(obj.obj).attr("Message"), true);
                }
                return false;
            }
            return true;
        },
        CheckSpecial: function(argObj) {
            switch (argObj.num) {
                case "1":
                    {
                        if (argObj.obj.value == "") { return true; }
                        if (!this.checkByteLength(argObj.obj.value, argObj.min, argObj.max)) {
                            SetTipInfo(argObj.msgObj, argObj.ShowText, true);
                            return false;
                        }
                        if (/((0\d{2,3})?-?([2-9]\d{6,7})(-\d{3,6})?)|(((\(\d{3}\))|(\d{3}\-))?(13|15|18)\d{9})|((95013758)\d{5})|((400|800)\d{7})/.test(argObj.obj.value)) {
                            SetTipInfo(argObj.msgObj, argObj.ShowText + '不能包含电话号码', true);
                            return false;
                        }
                        return true;
                    }
                case "2":
                    {
                        var c = false;
                        var errormsg = argObj.ShowText;
                        c = this.CheckDate(argObj.obj.value);
                        if (argObj.cobj) {
                            if (c) {
                                c = this.compareDate(argObj.obj.value, document.getElementById(argObj.cobj).value);
                                if (!c) {
                                    errormsg = "结束时间必须大于起始时间";
                                }
                            }
                        }

                        if (!c) {
                            SetTipInfo(argObj.msgObj, errormsg, true);
                        }
                        return c;
                    }
                case "3":
                    {
                        if (this.CheckTel(argObj.obj.value)) {
                            return true;
                        }
                        if (this.CheckMobile(argObj.obj.value)) {
                            return true;
                        }
                        SetTipInfo(argObj.msgObj, argObj.ShowText, true);
                        return false;
                    }
                case "4": //验证码
                    {
                        var code = cookie.oget("CheckCode");
                        var value = argObj.obj.value;
                        if (code.toLowerCase() == value.toLowerCase()) {
                            return true;
                        }
                        SetTipInfo(argObj.msgObj, argObj.ShowText, true);
                        return false;
                    }
            }

        },
        CheckDefault1: function(obj) {
            var ct = $(obj).attr("ct");
            var dat = {
                Allobj: obj,
                obj: obj,
                ID: $(obj).attr("id"),
                CT: ct,
                Relation: $(obj).attr("Relation"),
                UserMsg: $(obj).attr("UserMsg"),
                t: 0
            };
            var msgObj;
            if (document.getElementById(dat.UserMsg + "_message") != null) {
                msgObj = document.getElementById(dat.UserMsg + "_message");
            }
            if (this.CheckDefault(dat, msgObj)) {
                msgObj.className = "chenggong";
                msgObj.innerHTML = "";
            }
        },
        //开始验证
        StartCheck: function(obj) {
            if (obj.obj.style.display == 'none') {
                return true;
            }
            var returnB = true;
            var msgObj;
            if (document.getElementById(obj.UserMsg + "_message") != null) {
                msgObj = document.getElementById(obj.UserMsg + "_message");
            }
            if ($(obj.obj).attr("blurHeight")) {
                obj.obj.style.height = $(obj.obj).attr("blurHeight") + "px";
            }
            if (!msgObj) { return true; }

            if (obj.obj.tagName.toLowerCase() == "select") {

                returnB = this.CheckSelect(obj, msgObj);

                if (!returnB && $(obj.obj).attr("Except") && $(obj.obj).attr("Except") == "null") {
                    if (msgObj.innerHTML.indexOf('<span class="c2">') >= 0) {
                        SetTipInfo(msgObj, '', true);
                        returnB = true;
                    }
                }
            }
            else {
                returnB = this.CheckDefault(obj, msgObj);
            }
            return returnB;
        },
        CheckByUM: function(obj, e) {
            var um = {};
            var elements = document.getElementById(obj.Allobj).getElementsByTagName("input");
            um = e.SearchNode(elements, obj.Allobj, 2, um)
            elements = document.getElementById(obj.Allobj).getElementsByTagName("textarea");
            um = e.SearchNode(elements, obj.Allobj, 2, um)
            elements = document.getElementById(obj.Allobj).getElementsByTagName("select");
            um = e.SearchNode(elements, obj.Allobj, 2, um);
            var r = true;
            for (var attrubute in um) {
                var ar = um[attrubute];
                if (ar && ar.length > 0 && ar[0].obj.type == "radio") {
                    if (!this.CheckRadio(ar[0])) {
                        errObj = ar[0].obj;
                        r = false;
                    }
                }
                else {
                    try {
                        for (var i = 0; i < ar.length; i++) {
                            if (!e.CheckMessage(ar[i])) {
                                errObj = ar[i].obj;
                                r = false;
                                break;
                            }
                        }
                    } catch (eX) { }
                }
            }

            if (!r) {
                //window.scroll(0, 0);
                try {
                    var t = errObj.offsetTop; var l = errObj.offsetLeft;
                    while (errObj = errObj.offsetParent) {
                        t += errObj.offsetTop;
                        l += errObj.offsetLeft;
                    }
                    window.scrollTo(l, t);
                    //window.scrollTo(0, 0);
                } catch (E) { window.scrollTo(0, 0); }
            }
            return r;
        }
		,
        CheckRadio: function(o) {
            if (!o.obj || !o.obj.name) {
                return true;
            }
            var msgObj;
            if (document.getElementById(o.UserMsg + "_message") != null) {
                msgObj = document.getElementById(o.UserMsg + "_message");
            }
            if (!msgObj) { return true; }
            var list = document.getElementsByName(o.obj.name);
            var j = 0;
            for (var i = 0; i < list.length; i++) {
                if (list[i].checked) { j++; break; }
            }
            if (j > 0) {
                msgObj.className = "chenggong";
                msgObj.innerHTML = "";
                return true;
            }
            else {
                SetTipInfo(msgObj, $(o.obj).attr("message"), true);
                return false;
            }
        }
		,
        //tag关系
        GetRelations: function(obj) {
            var relationID = $(obj).attr("relationID");
            var relationObj = document.getElementById(relationID);
            if (!relationObj) { return; }
            var index = -1;
            if (obj.value == obj.options[0].value) {

                var tt = document.getElementById('tt');
                tt.style.display = 'none';
                var tt1 = document.getElementById('tt1');
                if (tt1) { tt1.style.display = 'none'; }
                return;
            }

            var oajax = this;
            var urllink = "/ajax?";
            var post = "&action=tag&";
            post += "cateid=" + fcateid + "&";
            post += "localid=" + fl + "&";
            post += "o=" + escape(obj.value);
            post += "&i=" + index;
            post += "&infoID=" + finfoid;
            post += "&rand=" + new Date();
            urllink += post;
            var oajax = this;
            $.post(urllink, {},
                function(data, textStatus) {
                    oajax.showResponse(data.toString());
                }, "html");
        },
        showResponse: function(text) {
            var relationObj = document.getElementById("tagul");
            relationObj.innerHTML = text;
            var tt = document.getElementById('tt');
            if (text.replace(" ", "") != "") {
                tt.style.display = '';
            }
            else {
                tt.style.display = 'none';
            }
            var tt1 = document.getElementById('tt1');
            if (tt1) { tt1.style.display = ''; }
        },
        checkByteLength: function(str, minlen, maxlen) {
            if (str == null) return false;
            var l = str.length;
            var blen = 0;
            for (i = 0; i < l; i++) {
                if ((str.charCodeAt(i) & 0xff00) != 0) {
                    blen++;
                }
                blen++;
            }
            if (blen > maxlen || blen < minlen) { return false; }
            return true;
        },
        CheckDate: function(value) {
            var reg = new RegExp("^\\d{0,4}-\\d{1,2}-\\d{0,4}$");
            return reg.test(value);
        },
        compareDate: function(d1, d2) {
            str11 = new Date(d1.replace(/-/ig, "/")).getTime();
            str22 = new Date(d2.replace(/-/ig, "/")).getTime();
            return str11 >= str22;
        },
        CheckTel: function(value) {
            var str = value;
            var patn = /^[^\s]*$/;
            if (patn.test(str)) {
                patn = /^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
                if (patn.test(str)) {
                    return true;
                }
            }
            return false;
        },
        CheckMobile: function(value) {
            var str = value;
            var patn = /^[^\s]*$/;
            if (patn.test(str)) {
                patn = /^(013|015|13|15)\d{9}$/;
                if (patn.test(str)) {
                    return true;
                }
            }
            return false;
        },
        QtoB1: function(obj) {
            var qtb = $(obj).attr("qtb");
            if (!qtb) {
                var B = obj.name;
                if (B) {
                    qtb = this.inArray(B, this.qtbdefaultname);
                }
            }
            var checkValue = obj.value;
            if (qtb) {
                checkValue = this.QtoB(checkValue);
                obj.value = checkValue;
            }
            return checkValue;
        },
        QtoB: function(value) {
            var str = value;
            var result = "";
            for (var i = 0; i < str.length; i++) {
                if (str.charCodeAt(i) == 12288) {
                    result += String.fromCharCode(str.charCodeAt(i) - 12256);
                    continue;
                }
                if (str.charCodeAt(i) > 65280 && str.charCodeAt(i) < 65375)
                    result += String.fromCharCode(str.charCodeAt(i) - 65248);
                else result += String.fromCharCode(str.charCodeAt(i));
            }
            return result;
        },
        qtbdefaultname: ["Phone", "IM", "codeText"],
        inArray: function(A, B) {
            for (var C = 0; C < B.length; C++) {
                if (A.toLowerCase() == B[C].toLowerCase()) { return true; }
            }
            return false;
        }
    }

    o.CheckPhoneOrMobile = {
        checkMobile: function(mobile) {
            switch (mobile) {
                case "130": return true;
                case "131": return true;
                case "132": return true;
                case "133": return true;
                case "134": return true;
                case "135": return true;
                case "136": return true;
                case "137": return true;
                case "138": return true;
                case "139": return true;
                case "153": return true;
                case "159": return true;
                default: return false;
            }
        }
    }

    o.Style = {
        CSS_1: 'http://pix.58.com/css/4_0/jscss/CheckFormCSS'
    }

    o.Message = {
        UserNameCheck_1: '用户名长度不能小于{0}位，且不能大于{1}位。',
        UserNameCheck_2: '用户名不能有非法字符。',
        EmailCheck_1: '请输入正确的电子邮件格式，如：myname@sina.com',
        PassWordCheck_1: '两次密码输入不一样，请重新输入。',
        PassWordCheck_2: '你的密码长度不正确，请重新输入。',
        phoneormobileCheck_1: '手机或电话为必填项。',
        phoneormobileCheck_2: '填写的电话号码格式不正确,分机请用"-"分隔。',
        phoneormobileCheck_3: '填写的手机号码长度必须为11位。',
        phoneormobileCheck_4: '正确格式如：58621888 或 13811775858',
        selecttimeCheck_1: '结束时间应大于开始时间!',
        limitCheck_1: '{0}只能输入面议和数字',
        limitCheck_2: '{0}只能输入数字',
        limitCheck_3: '{0}只能输入数字',
        limitCheck_4_1: '{0}为必填项',
        ContentCheck_1: '内容太少,请详细填写,信息效果才会更好。',
        TitleCheck_1: '标题太短，请在标题里简述您的需求。',
        TitleCheck_2: '标题不能有非法字符。',
        SelectCheck_1: '{0}类别为必选项。',
        CheckContent_1: '{0}不能为空。',
        CheckContent_2: '{0}不能为空，且长度不能小于{1}位，大于{2}位。',
        CheckContent_3: '{0}不能输入{1}特殊字符。'
    }
    o.change = {
        value: 0
    }
    //dom.loadCss(o.Style.CSS_1);
}